﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using WebAppWeChatDemo.Models;

namespace WebAppWeChatDemo.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            SendMessageModel result = new SendMessageModel()
            {
                appid = "wx8c3d6207dc42d2bd",
                appsecret = "e9b2746cadca984cfa966f2623daa908",
                openid = "ozrY05rmUVHbade_tLk5iIaVaDcE",
                template_id = "NvQeUx4xEAQ-XBZUdhN0X1Iyqb4SmP3_LAHE0RxojuQ",
                message = "{'name':{'value':'zainzhou','color':'#173177'},'time':{'value':'3分钟','color':'#ff0000'}}"
            };
            return View(result);
        }
        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Index(SendMessageModel model)
        {
            var wechart = new WeChartHelper();
            wechart.AddMessage(model);
            return View(model);
        }

        public ActionResult SendResult(string result = "")
        {
            ViewBag.sendMessage = result;
            return View();
        }

        public ActionResult About()
        {
            ViewBag.Message = "Your application description page.";

            return View();
        }

        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";

            return View();
        }
    }
}